use napi::Env;
use rolldown_tracing::try_init_tracing;
pub mod napi_error;
pub mod normalize_binding_options;

pub fn try_init_custom_trace_subscriber(mut napi_env: Env) {
  let maybe_guard = try_init_tracing();
  if let Some(guard) = maybe_guard {
    napi_env
      .add_env_cleanup_hook(guard, |flush_guard| {
        flush_guard.flush();
        drop(flush_guard);
      })
      .expect("Should able to initialize cleanup for custom trace subscriber");
  }
}
